if (isDedicated) exitWith {};
waituntil {!(isNull player) && {player == player}};

if (_this select 0) then {
	_title = "Initial Gear";
	_slot = 0;

	//Old format / code
	_primary = primaryWeapon player;
	_launcher = secondaryWeapon player;
	_handgun = handGunWeapon player;
	_magazines = [];
	_uniform = uniform player;
	_vest = vest player;
	_backpack = backpack player;
	_items = assignedItems player;
	_primitems = primaryWeaponItems player;
	_secitems = secondaryWeaponItems player;
	_handgunitems = handGunItems player;
	_uitems = [];
	_vitems = [];
	_bitems = [];
	if(_uniform != "") then {{_uitems set[count _uitems,_x];} foreach (uniformItems player);};
	if(_vest != "") then {{_vitems set[count _vitems,_x];} foreach (vestItems player);};
	if(_backpack != "") then {{_bitems set[count _bitems,_x];} foreach (backPackItems player);};

	{
		for [{_i = 0},{_i < count _x},{_i = _i + 1}] do {
			_base = configName(inheritsFrom (configFile >> "CfgWeapons" >> (_x select _i)));
			//diag_log [(_x select _i), (_x select _i) isKindOf "ItemRadio", _base];
			if (_base == "ItemRadio" && (_x select _i) != "ItemRadio") then {
				_x set [_i, "ItemRadio"];
				//diag_log ["Replaced",_x];
			};
		};
		//diag_log _x;
	} foreach [_items, _uitems, _vitems, _bitems];

	if(goggles player != "") then { _items set[count _items, goggles player]; };
	if(headgear player != "") then { _items set[count _items, headgear player]; };
	if(count (primaryWeaponMagazine player) > 0) then
	{
		{
			_magazines set[count _magazines,_x];
		} foreach (primaryWeaponMagazine player);
	};

	if(count (secondaryWeaponMagazine player) > 0) then
	{
		{
			_magazines set[count _magazines,_x];
		} foreach (secondaryWeaponMagazine player);
	};

	if(count (handgunMagazine player) > 0) then
	{
		{
			_magazines set[count _magazines,_x];
		} foreach (handgunMagazine player);
	};
	missionNamespace setVariable[format["vas_gear_new_%1",_slot],[_title,_primary,_launcher,_handgun,_magazines,_uniform,_vest,_backpack,_items,_primitems,_secitems,_handgunitems,_uitems,_vitems,_bitems]];
	VAS_slot = _slot;
	VAS_Respawn_Handler = player addEventHandler ["Respawn", {[VAS_slot] spawn VAS_fnc_loadGear;}];
};